<?php include_once"header.php" ?>

        <div class="tm-about-img-container">
            
        </div>

        <section class="tm-section">
            <div class="container-fluid" id="blog_list">
                

                <div id="pagination">
                   <div id="page" class="orange"><span class="disabled">首页</span><span class="disabled">上一页</span><span class="current">1</span><a href="?action=article_list&amp;page=2">2</a><a href="?action=article_list&amp;page=2">下一页</a><a href="?action=article_list&amp;page=2">末页</a><input class="text" type="text" id="jump2Page" onkeyup="this.value=this.value.replace(/[^\d]*/g,&quot;&quot;)" name="page"><a href="" class="button" id="jump2">go</a><script>
var sel = document.getElementById('jump2');sel.onclick=function(){var p = document.getElementById('jump2Page').value;this.href=('?action=article_list&page='+(p?p:1))}</script><span class="desc">共 2页11条记录</span></div>
                </div>

            </div>
            
        </section>
        
<?php include_once"footer.php" ?>

<script type="text/javascript">
  $(function(){

    $.ajax({
      url:'api/search.php',
      type:'get',
      dataType:'json',
      data:{action:'blog_blog',limit:8},
      success:function(data){
        var dt = data.data;
        var str = '';
        for(let i =0 ;i<dt.length;i++){
            console.log(dt[i]['art_img']);
            if((i+1)%4 == 1){
                str += '<div class="row tm-margin-t-mid">'
            }

            str +='<div class="col-xs-12 col-sm-6 col-md-3 col-lg-3 col-xl-3">'
            str +='    <div class="tm-content-box">'
            str +='      <img src="uploads/'+ dt[i].art_img +'" alt="Image" class="tm-margin-b-30 img-fluid">'
            str +='      <h4 class="tm-margin-b-20 tm-gold-text">' + dt[i]['art_title'] + '</h4>'
            str +='      <p class="tm-margin-b-20">' + dt[i]['art_desc'] + '</p>'
            str +='      <a href="blog.php?id='+ dt[i]['art_id'] +'" class="tm-btn text-uppercase">Detail</a>'
            str +='    </div>'
            str +='  </div>' 

            if((i+1)%4 == 0){
                str += '  </div>'
            }
        }

        $('#blog_list').empty().append(str);
      }
    })

  })
  
</script>